import logging

from replace_simple_fn_date_format import replace_simple_date_format
from replace_simple_fn_from_unixtime import replace_simple_from_unixtime
from replace_simple_fn_ifnull import rep_simple_fn_ifnull
from replace_simple_fn_isnull import rep_simple_fn_isnull
from replace_simple_fn_nvl import rep_simple_fn_nvl
from replace_simple_fn_substr import rep_simple_fn_substr
from replace_simple_fn_unix_timestamp import replace_simple_unix_timestamp
from replace_simple_fn_cast import replace_simple_cast_type
from replace_simple_fn_if import rep_simple_if

def replace_simple_main(document_content):
    logging.info(" 开始调用 「replace_simple_main」 进行简单函数替换 ")

    # (1) 替换简单的 date_format
    document_content = replace_simple_date_format(document_content)

    # （2）替换简单的 from_unixtime
    document_content = replace_simple_from_unixtime(document_content)

    # （3）替换简单的unix_timestamp
    document_content = replace_simple_unix_timestamp(document_content)

    # （4）简单if 替换
    document_content = rep_simple_if(document_content)

    # （5）简单IFNULL 函数替换
    document_content = rep_simple_fn_ifnull(document_content)

    # （6）简单的 ISNULL 函数替换
    document_content = rep_simple_fn_isnull(document_content)

    # （7）简单的 NVL 函数替换
    document_content = rep_simple_fn_nvl(document_content)

    # substr(delivery_date,1,7)
    document_content = rep_simple_fn_substr(document_content)

    # （7）类型替换
    document_content = replace_simple_cast_type(document_content)

    logging.info(" 结束调用 「replace_simple_main」 进行简单函数替换 ")
    return document_content
